package com.flight.trans.adapter;

import android.content.Context;
import android.widget.TextView;

import com.flight.trans.R;
import com.flight.trans.bean.LeavePortGroupBoardDetailBean.GroupBoardDetailData.DetailsOrderData;
import com.flight.trans.global.Constant;
import com.flight.trans.base.BaseRecyclerAdapter;
import com.flight.trans.base.BaseViewHolder;
import com.flight.trans.util.CommonUtils;

import java.util.List;

/**
 * 出港组板
 */
public class LeavePortGroupBoardDetailsResultAdapter extends BaseRecyclerAdapter<DetailsOrderData> {

    public LeavePortGroupBoardDetailsResultAdapter(Context mContext, List<DetailsOrderData> mList) {
        super(mContext, mList);
    }

    @Override
    public int setContentView() {
        return R.layout.adapter_leave_port_group_board_details_result;
    }

    @Override
    protected void bindData(BaseViewHolder holder, DetailsOrderData data, int position) {
        TextView mTvPosition = holder.findViewById(R.id.mTvPosition);//序号
        TextView mTvContainerNo = holder.findViewById(R.id.mTvContainerNo);//容器号
        TextView mTvCount = holder.findViewById(R.id.mTvCount);//件数
        TextView mTvWeight = holder.findViewById(R.id.mTvWeight);//重量
        TextView mTvDeep = holder.findViewById(R.id.mTvDeep);//目的地
        TextView mTvVolume = holder.findViewById(R.id.mTvVolume);//体积

        mTvPosition.setText(String.valueOf(data.getPosition() == Constant.SortNullPosition ? (position + 1) : data.getPosition()));

        mTvContainerNo.setText(data.getTransportCode());
        mTvCount.setText(String.valueOf(data.getNumber()));
        mTvWeight.setText(String.valueOf(data.getWeight()));
        mTvDeep.setText(String.valueOf(data.getDeap()));

        mTvVolume.setText(data.getVolumeSum() != 0 ? CommonUtils.getDoubleFour(data.getVolumeSum()) : "");

        setOnTextClickListener(mTvVolume , position);
    }
}
